package app;


import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import util.Util;

import java.util.Date;

@Data
@NoArgsConstructor
@ToString
@EqualsAndHashCode
public class FileMeta {
    private  String name;
    private String path;
    private Boolean isDirectory;
    private Long size;
    private Date lastModified;
    private String pinYIN;
    private String pinYinFtrst;
    //文件类型
    private String isDirectoryText;
    //文件大小
    private String sizeText;
    //修改时间
    private String lastModifiedText;

    public void setSize(Long size) {
        this.size = size;
        this.sizeText = Util.parseSize(size);
    }
    public void setDirectory(Boolean directory) {
        isDirectory = directory;
        this.isDirectoryText = Util.parseFileType(directory);
    }
    public void setLastModified(Date lastModified) {
        this.lastModified = lastModified;
        this.lastModifiedText = Util.parseDate(lastModified);
    }
    public FileMeta(String name, String path, Boolean isDirectory, Long size, Date lastModified) {
        this.name = name;
        this.path = path;
        this.isDirectory = isDirectory;
        this.size = size;
        this.lastModified = lastModified;
    }
}